﻿#ifndef CHANNELCHATROOM_H
#define CHANNELCHATROOM_H

#include <QWidget>
#include "chatroom.h"

class ChannelChatRoom : public ChatRoom
{
    Q_OBJECT
public:
    explicit ChannelChatRoom(const ChannelInfo &channel_info, QWidget *parent = Q_NULLPTR);
    ~ChannelChatRoom() Q_DECL_OVERRIDE;
    void handle_msg(int type, const QVariantHash &msg) Q_DECL_OVERRIDE;
    void handle_channel_event(int cmd_type, QVariantHash &msg, ChannelInfo &channel_info);
    void handle_join(QVariantHash &msg);
    void handle_exit(QVariantHash &msg);

    void handle_onlines_ack(int result, QVariantHash &msg, const ChannelInfo &channel_info);
    void handle_mic_change(const QSet<qint64> &old_audio, const QSet<qint64> &new_audio,
                           const QSet<qint64> &old_video, const QSet<qint64> &new_video,
                           const QSet<qint64> &old_apply, const QSet<qint64> &new_apply);
protected:
    void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
    QByteArray send_msg(int msg_type, const QString& text) Q_DECL_OVERRIDE;
    void startSpeak() Q_DECL_OVERRIDE;
    void stopSpeak() Q_DECL_OVERRIDE;
private slots:
    void slot_free_mic();
    void slot_grant_mic();
private:
    void on_button_meeting_clicked(bool checked) Q_DECL_OVERRIDE;
    void on_button_camera_clicked(bool checked) Q_DECL_OVERRIDE;
    void on_list_online_user_customContextMenuRequested(const QPoint &pos) Q_DECL_OVERRIDE;

    QBasicTimer applyTimer;
};

#endif // CHANNELCHATROOM_H
